﻿using JzSport.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace JzSport.Api
{
    class GetSettingsAction : GetAction<GetSettingsParams,
        GetSettingsResult>
    {
        protected override ActionResult<GetSettingsResult> OnExecute(ActionContext context,
            SysParameters sysParameters,
            GetSettingsParams opParams)
        {
            GetSettingsResult result = new GetSettingsResult();
            result.AppEvaluationUrl = string.Format("{0}{1}", Configs.BaseWebUrl, "AppEvaluation.html");
            result.UserAgreementUrl = string.Format("{0}{1}", Configs.BaseWebUrl, "Html/UserAgreement.html");
            return new ActionResult<GetSettingsResult>(true, ErrorCode.NoError,
                ErrorCode.ToString(ErrorCode.NoError), result);
        }
    }

    public class GetSettingsParams : IActionParams
    {
        public void ParseQueryString(HttpRequest request)
        {
        }

        public void ParseForm(HttpRequest request)
        {
        }
    }

    public class GetSettingsResult
    {
        /// <summary>
        /// 应用程序评价链接地址
        /// </summary>
        public string AppEvaluationUrl { get; set; }
        /// <summary>
        /// 用户协议地址
        /// </summary>
        public string UserAgreementUrl { get; set; }
    }
}
